<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ include file="/commons/global.jsp" %>
<script type="text/javascript">
    $(function() {
    
		 $('#spec').combobox({
    	    url : '${path }/customer/spec',
    	    editable: false,
    	    required: true,
    	    valueField:'id',   
    	    textField:'eleSpec',
    	    onLoadSuccess:function(data){ 
    	        $('#spec').combobox('select','${customer.specId}');
    	    } 
    	});    
    	
    	$('#rate').combobox({
    	    url : '${path }/customer/rate',
    	    editable: false,
    	    required: true,
    	    valueField:'id',   
    	    textField:'eleRate',
    	    onLoadSuccess:function(data){ 
    	        $('#rate').combobox('select','${customer.rateId}');
    	    } 
    	});
    	
    	
    	 $('#meter').combobox({
    	    url : '${path }/customer/meter',
    	    editable: false,
    	    required: true,
    	    valueField:'id',   
    	    textField:'metering',
    	    onLoadSuccess:function(data){ 
    	        $('#meter').combobox('select','${customer.meterId}');
    	    } 
    	});
    
        $('#customerEditForm').form({
            url : '${path}/customer/edit',
            onSubmit : function() {
                progressLoad();
                var isValid = $(this).form('validate');
                if (!isValid) {
                    progressClose();
                }
                return isValid;
            },
            success : function(result) {
                progressClose();
                result = $.parseJSON(result);
                if (result.success) {
                    parent.$.modalDialog.openner_dataGrid.datagrid('reload');//之所以能在这里调用到parent.$.modalDialog.openner_dataGrid这个对象，是因为user.jsp页面预定义好了
                    parent.$.modalDialog.handler.dialog('close');
                } else {
                    parent.$.messager.alert('错误', result.msg, 'error');
                }
            }
        });
    });
</script>
<div class="easyui-layout" data-options="fit:true,border:false">
    <div data-options="region:'center',border:false" title="" style="overflow: hidden;padding: 3px;">
        <form id="customerEditForm" method="post">
            <table class="grid">
            	<tr>
                    <td>联系人</td>
                    <td>
                    <input name="name" type="text" placeholder="请输入名称" class="easyui-validatebox" data-options="required:true" value="${customer.name}"></td>
               		  <td>户号</td>
                    <td>
                    <input name="accountNumber" type="text" placeholder="请输入户号" class="easyui-validatebox" data-options="required:true" value="${customer.accountNumber}"></td>
                </tr>
            
                <tr>
                    <td>电能表编号</td>
                    <td><input type="text" name="eleNum" value="${customer.eleNum}"></td>
               		<td>联系方式</td>
                    <td>
                    <input name="phone" type="text" placeholder="请输入联系方式" class="easyui-validatebox" data-options="required:true" value="${customer.phone}"></td>
                </tr>
                 <tr>
                    <td>计量装置</td>
                    <td><input id="meter" name="meterId" style="width: 140px; height: 29px;"></select></td>
                    <td>规格</td>
                    <td><input id="spec" name="specId" style="width: 140px; height: 29px;"></select></td>
                </tr>
                 <tr>
                    <td>倍率</td>
                    <td><input id="rate" name="rateId" style="width: 140px; height: 29px;"  ></select></td>
                </tr>
            </table>
            <input type="hidden" name="id" value="${customer.id}" data-options="required:true" >
        </form>
    </div>
</div>